package tech.aistar.corejava.day10.stringextends;

public class StringCompareDemo02 {
    public static void main(String[] args) {
        //final String x = "a";
        //String x1 = x + "b";//"a" + "b" -> "ab" -> x1指向的是常量池

        String x = "a";

        //x1 -> 指向的堆
        String x1 = x + "b";//JDK8.0会+进行了一些优化,n->new StringBuilder(x);   n.append("b");

        System.out.println("ab" == x1);//false
    }
}
